home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / ole2book.zip / BASICS.ZIP / INC / IENUM0.H < prev    next >
C/C++ Source or Header  |  1993-03-16  |  2KB  |  71 lines

  1. /*
  2.  * IENUM0.H
  3.  *
  4.  * Definition of an IEnumRECT interface as an example of the
  5.  * interface notion introduced in OLE 2.0 with the Component Object
  6.  * Model as well as the idea of enumerators.  This include file defines
  7.  * the interface differently for C or C++.
  8.  *
  9.  * Copyright (c)1993 Microsoft Corporation, All Rights Reserved
  10.  *
  11.  * Kraig Brockschmidt, Software Design Engineer
  12.  * Microsoft Systems Developer Relations
  13.  *
  14.  * Internet  :  kraigb@microsoft.com
  15.  * Compuserve:  >INTERNET:kraigb@microsoft.com
  16.  */
  17.  
  18.  
  19. #ifndef _IENUM0_H_
  20. #define _IENUM0_H_
  21.  
  22.  
  23. //C++ Definition of an interface.
  24. #ifdef __cplusplus
  25.  
  26.  
  27. //This is the interface:  a struct of pure virtual functions.
  28. struct __far IEnumRECT
  29.     {
  30.     virtual DWORD AddRef(void)=0;
  31.     virtual DWORD Release(void)=0;
  32.     virtual BOOL  Next(DWORD, LPRECT, LPDWORD)=0;
  33.     virtual BOOL  Skip(DWORD)=0;
  34.     virtual void  Reset(void)=0;
  35.     };
  36.  
  37. typedef IEnumRECT FAR * LPENUMRECT;
  38.  
  39.  
  40. #else   //!__cplusplus
  41.  
  42. /*
  43.  * A C interface is explicitly a structure containing a long
  44.  * pointer to a virtual function table that we have to initialize
  45.  * explicitly.
  46.  */
  47.  
  48. typedef struct
  49.     {
  50.     struct IEnumRECTVtbl FAR *lpVtbl;
  51.     } IEnumRECT;
  52.  
  53. typedef IEnumRECT FAR * LPENUMRECT;
  54.  
  55. //This is just a convenient naming
  56. typedef struct IEnumRECTVtbl IEnumRECTVtbl;
  57.  
  58.  
  59. struct IEnumRECTVtbl
  60.     {
  61.     DWORD (* AddRef)(LPENUMRECT);
  62.     DWORD (* Release)(LPENUMRECT);
  63.     BOOL  (* Next)(LPENUMRECT, DWORD, LPRECT, LPDWORD);
  64.     BOOL  (* Skip)(LPENUMRECT, DWORD);
  65.     void  (* Reset)(LPENUMRECT);
  66.     };
  67.  
  68. #endif  //!__cplusplus
  69.  
  70. #endif //_IENUM0_H_
  71.